package apiday01;

public class StringBuilderDemo {
    public static void main(String[] args) {
        String str = "好好学习java";
        StringBuilder builder = new StringBuilder(str);

        builder.append(",为了找个好工作");
        System.out.println(builder);

        builder.replace(0,16,"        ,谁不想咸鱼嘞");
        System.out.println(builder);


        //delete()删除部分内容，含头不含尾---删除下标0-7的内容
        builder.delete(0,8);

        //insert():插入内容
        builder.insert(0,"活着");
        System.out.println(builder);


        /**
        StringBuilder builder1  = new StringBuilder();
        StringBuilder builder2  = new StringBuilder("abc");
        String str = "abc";
        StringBuilder builder3  = new StringBuilder(str);
         */
    }
}
